package com.hdax.ssm.controller;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.hdax.ssm.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
public class RoleController {
    @Autowired
    private RoleService roleService;

    @RequestMapping("/queryRole")
    public Map<String,Object> queryRole(Integer offset,Integer limit){
        Map<String,Object> map = new HashMap<>();
        Page page = PageHelper.offsetPage(offset,limit,true);
        roleService.getAllRole();
        map.put("total",page.getTotal());
        map.put("rows",page.getResult());
        return map;
    }

}
